1. Field of the Invention
The present invention relates to a method and an apparatus for identifying a position in runlength compression data.
2. Description of the Related Art
Following improvements in processing performance by computers, data of large size are frequently being dealt with. When such large data are dealt with as they are, the amount of data processing increases, and a large memory space is occupied. Therefore, such data processing is inefficient and not economical. For this reason, data compression has been carried out to decrease a data size while losing as little information as possible.
Various data compression methods have been proposed. As one of such methods, a runlength compression method has been used. In runlength compression, redundancy of data of the same value appearing serially is used for coding the length of the serial data, and runlength compression data comprise length data representing the length. For example, a binary image comprising only black and white pixels can be represented by lengths of serial white pixels and lengths of serial black pixels (see Japanese Unexamined Patent Publication No. 2001-102937, for example).
In data processing, a value at a desired position in original data is sometimes read or processed. In this case, the desired position in the original data needs to be specified. In the original data before compression, an address is generally related to each value, and specification of the desired position is comparatively easy based on the address. However, in runlength compression data, an address is not related to each value. Therefore, in order to specify a position in the runlength compression data corresponding to the desired position in the original data, the order (the Nth position, in this case) of the position from the first value is found in the original data. Lengths of values (that is, the number of values) included in length data comprising the runlength compression data are then added up from the beginning of the runlength compression data, and compared with N to judge whether or not a result of the addition is larger than N. In this manner, the desired position can be found in the runlength compression data.
However, serial addition of lengths of values included in length data from the beginning may need a large amount of operations.